package Month07.day05;

import java.util.Scanner;

public class test {
    public static void main(String[] args) {
        int[] arr = new int[6];
        Scanner scanner = new Scanner(System.in);
        for (int i = 0; i < arr.length; i++) {
            System.out.println("输入第" + (i + 1) + "个数据");
            int sc = scanner.nextInt();
            arr[i] = sc;
        }
        System.out.println("===========将数组中的元素反转==========");
        for (int i = 0, end = arr.length - 1; i < end; i++, end--) {
            int temp = arr[i];
            arr[i] = arr[end];
            arr[end] = temp;
        }
        for (int i = 0; i < arr.length - 2; i++) {
            if (i % 2 != 0) {
                int temp = arr[i];
                arr[i] = arr[i + 2];
                arr[i + 2] = temp;
            }
            if (arr.length % 2 == 0) {
                int temp = arr[1];
                arr[1] = arr[arr.length - 1];
                arr[arr.length - 1] = temp;
            } else {
                int temp = arr[1];
                arr[1] = arr[arr.length - 2];
                arr[arr.length - 2] = temp;
            }
            System.out.print("[");
            for (int j = 0; j < arr.length; j++) {
                if (j == arr.length - 1) {
                    System.out.println(arr[j] + "]");
                } else {
                    System.out.print(arr[j] + ", ");
                }
            }
        }
    }
}
